package com.drought.rained.presenter;

import com.drought.rained.business.CustomConsumerLJ;
import com.drought.rained.business.ParamsFactoryLJ;
import com.drought.rained.cache.UserInfoLJ;
import com.drought.rained.mvpview.AuthMvpViewLJ;
import com.drought.rained.response.AuthResponseLJ;

import io.reactivex.functions.Consumer;

public class AuthPresenterLJ extends BasePresenterLJ {
    private AuthMvpViewLJ mvpView;

    public AuthPresenterLJ(AuthMvpViewLJ mvpView) {
        this.mvpView = mvpView;
    }

    public void getAuthStatus() {
        toSubScribe(req.getAuthStatus(UserInfoLJ.getToken(), ParamsFactoryLJ.getCommonParams(null)), new CustomConsumerLJ<AuthResponseLJ>() {
            @Override
            public void call(AuthResponseLJ response) {
                mvpView.onGetDataNext(response);
            }
        }, new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                mvpView.onGetDataError(throwable);
            }
        });
    }

}
